home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 016 / herc.arc / USER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1985-12-14  |  2.0 KB  |  104 lines

  1.  
  2. #include <dos.h>
  3. void putcur(int, int);
  4. cls()
  5. {
  6.         union REGS inr, outr;
  7.  
  8.         inr.h.al = 7;   /* Monochrome 80 X 25 */
  9.         inr.h.ah = 0;
  10.         int86(0x10, &inr, &outr);
  11.  
  12.         putcur(0,0);
  13. }
  14.  
  15.  
  16. #include <conio.h>
  17.  
  18. void beep()
  19. {
  20.         int x,y;
  21.  
  22.         x = 398 % 256;
  23.         y = 398 / 256;
  24.         outp(67,182);
  25.         outp(66,x);
  26.         outp(66,y);                     /* To here -sets timer freq */
  27.         outp(97,(inp(97) | 3));         /* Sound on */
  28.         for (y = 6000; y >0; y--)
  29.                 ;                       /* Stall awhile */
  30.         outp(97,(inp(97) & 0xfc));      /* Sound off */
  31. }
  32.  
  33.  
  34. #include <dos.h>
  35. putcur(r,c)
  36. int r, c;
  37. {
  38.         union REGS inr, outr;
  39.         inr.h.bh = 0;
  40.         inr.h.dh = r;
  41.         inr.h.dl = c;
  42.         inr.h.ah = 2;
  43.         int86(0x10, &inr, &outr);
  44. }
  45.  
  46.  
  47.  
  48. #include <dos.h>
  49. getcur(row, col)
  50. /*  Return current cursor position. USAGE:
  51. **  getcur(&row, &col); with row and col as ints
  52. */
  53.  
  54. int *row, *col;
  55. {
  56.         union REGS inr, outr;
  57.         inr.h.bh = 0;
  58.         inr.h.ah = 3;
  59.         int86(0x10, &inr, &outr);
  60.         *row = outr.h.dh;
  61.         *col = outr.h.dl;
  62. }
  63.  
  64. #include <dos.h>
  65. writeca(c, a, cnt)
  66. /* writes char c with attr. a, cnt times beginning at cursor position */
  67. char c, a;
  68. int cnt;
  69. {
  70. /*
  71. Some attribute values:
  72. REVERSE VIDEO & BLNK    = 0xf0;
  73. REVERSE VIDEO           = 0X70;
  74. NORMAL BUT WITH BLNK    = 0X87;
  75. NORMAL WITH NOBLNK      = 0x07;
  76. */
  77.         union REGS inr, outr;
  78.         inr.h.bh = 0;
  79.         inr.h.bl = a;
  80.         inr.h.al = c;
  81.         inr.x.cx = cnt;
  82.         inr.h.ah = 9;
  83.         int86(0x10, &inr, &outr);
  84. }
  85.  
  86. #include <dos.h>
  87. void putcur(int, int);
  88. void writeca(char, char, int);
  89. putsa(s, a, row, col)
  90. /* put string s to console with attribute a beginning at row, col */
  91. char *s, a;
  92. int row, col;
  93. {
  94.         int i;
  95.         for(i = 0; s[i] != '\0'; i++)
  96.                 {
  97.                 putcur(row, col++);
  98.                 writeca(s[i], a, 1);
  99.                 }
  100. }
  101.  
  102. 
  103.  
  104.